<template>
  <type-wrapper :name="name">
    <el-input-number
      :value="selectedValue"
      :min="config.min || 0"
      :max="config.max || 10"
      label="描述文字"
      size="small"
      @change="onChange"
    ></el-input-number>
  </type-wrapper>
</template>

<script>
import TypeWrapper from './type-wrapper.vue'
import { InputNumber } from 'element-ui'
export default {
  components: {
    'type-wrapper': TypeWrapper,
    'el-input-number': InputNumber,
  },
  props: {
    name: {
      type: String,
    },
    config: {
      type: Object,
    },
    extra: {
      type: Object,
    }
  },
  computed: {
    selectedValue() {
      if ('selectedValue' in this.extra) return this.extra.selectedValue
    }
  },
  methods: {
    onChange(value) {
      this.$emit('change', value)
    }
  },
  // mounted() {
  //   this.$emit('init', this.extra.selectedValue)
  // }
}
</script>